//
//  UnitsCell.m
//  趣·美食
//
//  Created by dllo on 15/9/25.
//  Copyright (c) 2015年 金旭. All rights reserved.
//

#import "UnitsCell.h"


@interface UnitsCell ()

@property (nonatomic, strong) UILabel *label1;
@property (nonatomic, strong) UILabel *label2;
@property (nonatomic, strong) UILabel *label3;
@property (nonatomic, assign) BOOL isnight;

@end

@implementation UnitsCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.label1 = [[UILabel alloc] init];
        [self.contentView addSubview:self.label1];
      
        
        self.label2 = [[UILabel alloc] init];
        [self.contentView addSubview:self.label2];
        
        
        self.label3 = [[UILabel alloc] init];
        [self.contentView addSubview:self.label3];
        
        
        
    }
    return self;
}




- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.label1.frame = CGRectMake(ScreenWidth / 375.0 * 20, ScreenWidth / 375.0 * 10, ScreenWidth / 375.0 * 100, ScreenWidth / 375.0 * 30);
    
    self.label2.frame = CGRectMake(ScreenWidth / 375.0 * 190, ScreenWidth / 375.0 * 10, ScreenWidth / 375.0 * 100, ScreenWidth / 375.0 * 30);
    self.label2.font = [UIFont systemFontOfSize:15];
    self.label2.textColor = [UIColor lightGrayColor];
    
    self.label3.frame = CGRectMake(ScreenWidth / 375.0 * 300, ScreenWidth / 375.0 * 10, ScreenWidth / 375.0 * 75, ScreenWidth / 375.0 * 30);
    self.label3.font = [UIFont systemFontOfSize:15];
    self.label3.textColor = [UIColor lightGrayColor];
}

- (void)setDeUnModel:(GFDetialUnitModel *)deUnModel {
    if (_deUnModel != deUnModel) {
        
        _deUnModel = deUnModel;
    }
    
    int a = self.deUnModel.amount.intValue;
    self.label1.text = [NSString stringWithFormat:@"%d%@", a, self.deUnModel.unit];
    
    int b = self.deUnModel.weight.intValue;
    int c = self.deUnModel.calory.intValue;
    
    self.label2.text = [NSString stringWithFormat:@"%d克", b];
    
    self.label3.text = [NSString stringWithFormat:@"%d大卡", c];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
